package utility

import (
	"math/rand"
	"time"
)


func GetRandomNumCreator() RandomNumCreator {
	return RandomNumCreator{
		time.Now().UnixNano(),
	}
}

type RandomNumCreator struct {
	Seed int64
}

func (r *RandomNumCreator) GetRandom(maxNum int) int {
	rand.Seed(r.Seed)
	r.Seed++
	return rand.Intn(maxNum)
}

func (r *RandomNumCreator)GetRandomArr(maxNum, maxLen int) []int {
	arrLen := r.GetRandom(maxLen)
	arr := make([]int, arrLen)
	for i:=0 ;i<arrLen; i++ {
		arr[i] = r.GetRandom(maxNum)
	}
	return arr
}

func (r *RandomNumCreator)GetRandomBool(arrLen int) []bool {
	ans := make([]bool, arrLen)
	for i:=0; i<arrLen; i++ {
		n := r.GetRandom(2)
		if n >= 1 {
			ans[i] = true
		}
	}
	return ans
}
